<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div.bigger {
      width: 500px;
      height: 500px;
      background-color: coral;
    }
    .box {
      width: 300px;
      height: 300px;
      border: 1px solid cadetblue;
      background-color: aqua;
      transition: 1s;
    }
  </style>
</head>
<body>
  <button>切换大小</button>
  <div class="box"></div>
</body>
</html>
<script>
var box = document.querySelector('.box');
var btn = document.querySelector('button');
// 借用 toggle 的思想，实现 大小的变化
btn.onclick = function() {
  console.log('click');
  box.classList.toggle('bigger');
}
</script>